#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main() {
    long a = 0;
    long b = 0;
    scanf("%ld %ld", &a, &b);
    long int k = a * b;
    while (a % b != 0)
    {
        int tmp = a;
        a = b;
        b = tmp % b;
    }
    printf("%ld", (k / b) + b);
    return 0;
}